package com.mobis.user.controller;


import com.mobis.user.pojo.Admin;
import com.mobis.user.service.AdminService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @RequestMapping(value = "",method = RequestMethod.POST)
    public Result adminLogin(@RequestBody Admin admin){

        Admin adminresult=adminService.findByNameAndPassword(admin.getLoginname(),admin.getPassword());
        if (null!=adminresult){

            return new Result(true, StatusCode.OK,"登陆成功");
        }
        return new Result(false,StatusCode.ERROR,"登陆失败");

    }
}
